import { get, post, put, del, getWithArgs } from '../utils/xFetch2'

const userAPI = {
    // 登录
    login: params => {
        return post('api/v1/users/login', params)
    },
    regist: params => {
        return post('api/v1/users/register', params)
    },
    list: params => {
        return getWithArgs('api/v1/users', params)
    },
    auth: () => {
        return get('api/v1/users/auth')
    },
    changeInfo: (id, params) => {
        return put(`api/v1/users/${id}`, params)
    },
    delete: id => {
        return del(`api/v1/users/${id}`)
    },
    deletes: ids => {
        return del(`api/v1/users`, ids)
    },
    adminUpdateUser: (id, params) => {
        return put(`api/v1/users/adminUpdate/${id}`, params)
    },
    userUpdate: params => {
        return put(`api/v1/users`, params)
    },
    userUpdatePass: params => {
        return put(`api/v1/users/updatePass`, params)
    }
}

export default userAPI
